package com.yzy.fly.config.properties;

import com.yzy.fly.function.logging.Log;
import com.yzy.fly.function.logging.LogFactory;
import com.yzy.fly.util.ClassUtil;
import lombok.Data;
//import org.apache.ibatis.logging.Log;
//import org.apache.ibatis.logging.LogFactory;

import java.io.Serializable;

@Data
public class LogConfiguration implements Serializable {

    private boolean enable;
    //    protected Class<? extends Log> logImpl;
    private String logImpl;
    protected Class<? extends Log> logImplClass;

    //    public void setLogImpl(Class<? extends Log> logImpl) {
    public void setLogImpl(String logImpl) {
        Class<? extends Log> logImplClass = ClassUtil.resolveClass(logImpl);
        if (logImpl != null) {
            this.logImpl = logImpl;
            this.logImplClass = logImplClass;
            LogFactory.useCustomLogging(this.logImplClass);
        }
    }

}
